 <meta charset="utf-8">
 <div class="card" id="biz_algorithm_conatainer" style="padding-bottom: 0px;">
 
   
 <div class="card">
 	<div class="card-body">
 	<div class="row">
 	
 	  <div class="col-md-2">
             <div class="table-responsive">
 <table class="table mb-0">
     <thead>
         <tr>
             <th>
			         <input type="text" class="form-control" ref="name"v-on:input = "initAlgorithmTable" placeholder="输入关键词查询...." />
    			 </th>
         </tr>
     </thead>
     <tbody>
         <tr v-for="(alg,index) in algorithmList">
             <td><button class="btn btn-outline btn-primary btn-block" v-on:click="loadConfig(alg)">{{alg.name}}</button></td>
         </tr>
     </tbody>
 </table>
             </div>
 	  </div>
 	  
 	  
 	  <div class="col-md-10">
 	  <div class="alert alert-warning" role="alert" v-if="nowAlgorithm.name">
            	 当前选择配置：<font color="red"><strong>【{{nowAlgorithm.name}}】</strong> </font>
     </div>
       <div class="table-responsive"  style="min-height: 500px;">
       <iframe id="algorithmConFigIframe" ref="algorithmConFigIframe" src="" width="100%" height="100%" style="border: 0px;min-height: 600px;"></iframe>
       </div>
                                            
                                        
                                        
 	  </div>
 	</div>
 	</div>
 	</div>
 	
 </div>
<script>
var anewaz=new Vue({  
	  el: '#biz_algorithm_conatainer', 
	  data:{
		  searchForm:{
			  name: null,
			  status: 1
		  },
		  nowAlgorithm:{},
		  algorithmList:[],
	      bus:new Vue()
	  },
	  mounted:function(){
		 var _this=this;
		 _this.initAlgorithmTable();
	  },

    methods: {
   	 initAlgorithmTable: function(){
  		 var　_this=this;
  		 var url="/manger/algorithm/loadAllAlgorithm";
		    zfesAjax.ajaxTodo(url, {"status":1,"name":_this.$refs.name.value,"maxCount":20}, function(data) {
				_this.algorithmList=data.data.algorithmList;
				console.log("--_this.algorithmList--",_this.algorithmList);
				if(_this.algorithmList&&_this.algorithmList.length>0){
					_this.nowAlgorithm=_this.algorithmList[0];
					_this.loadConfig(_this.nowAlgorithm);
				}
				
			});
 	 },
 	loadConfig : function(algorithm){
     		 var _this=this;
     		_this.nowAlgorithm=algorithm;
     		var algorithmId=algorithm.id;
     		store.set('ifream_param_', {algorithmId:algorithmId});
     		document.getElementById('algorithmConFigIframe').src="/view/algorithm/config/tree.html";
     	},
  	  formatLink: function(value, row, index ){
  		  return '<a href=\"javascript:void(0);\"  onclick=\"showDetail('+row+')\" >'+value+'</a>';
  	  },
      formatStatus: function(value, row, index ){
    	  if(0==value){
    		  return '<span class="btn btn-sm btn-warning">禁用</span>';
    	 }if(1==value){
    		  return '<span class="btn btn-sm btn-success">正常</span>';
    	 }else{return value;}
	  }, 
	  refresh:function(){
		  var　_this=this;
		  _this.loadItems(_this.nowAlgorithm);
	  },
  	addChildConfig: function(itemId){
 		 var　_this=this;
 		 var param={algorithmId: _this.nowAlgorithm.id,parentId:itemId};
 		 var url="/view/algorithm/config/algorithmConfigItem.add.html";
 		 zfesLayerEditDg.open(url,param,"编辑",460,function(){_this.loadConfig(_this.nowAlgorithm);});
 		 
 	},
 	editConfig: function(itemId){
 		 var　_this=this;
 		var param={id:itemId};
 		 var url="/view/algorithm/config/algorithmConfigItem.edit.html";
		 zfesLayerEditDg.open(url,param,"编辑",460,function(){_this.loadConfig(_this.nowAlgorithm);}); 
 	  },
	  setConfigEnable: function(itemId,status){
		  var _this=this;
			 alertSwal.confirm("提示","是否执行该操作",function(){
				    var ajaxUrl = "/manager/algorithm/config/setAlgorithmConfigItemStatus";
				    zfesAjax.ajaxTodo(ajaxUrl, { "id" : itemId,"status":status}, function(data) {
						alertSwal.successText(data.message);
						_this.loadConfig(_this.nowAlgorithm);
					});
				});
	  }
	  
   	
   }

});

function showDetail(row){
	anewaz.showDetail(row);
}
</script>


